package com.itkim.qian.mapper;

import com.itkim.judge.domain.YzJudgeRes;
import com.itkim.qian.domain.YzUserRes;
import com.itkim.qian.domain.YzWorkR;
import com.itkim.work.domain.YzFile;
import com.itkim.work.domain.YzWorkRes;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;


public interface LoginMapper {

    public YzUserRes login(YzUserRes yzUserRes);

    YzUserRes selectYzUserResByUserId(Long userId);

    int updatePassword(@Param("password") String newPassword,@Param("userId") Long userId);

    void baoming(@Param("userId") Long userId,@Param("yz") YzWorkRes yzWorkRes);

    void export(@Param("workId") Long workId,@Param("group") Integer group,@Param("yz") YzFile yzFile);

    List<YzWorkR> list(YzWorkR yzWorkR);

    @Insert("insert into yz_judge value (#{judgeId},#{userId},#{workId},#{judgeTeach},#{judgePlan},#{judgeVideo},#{judgePro},#{judgeCourse},#{judgeSelect},#{score},#{createTime})")
    int insertJudge(YzJudgeRes yzJudgeRes);

    @Select("select * from yz_judge where work_id = #{workId}")
    List<YzJudgeRes> selectYzJudgeByWorkId(Long workId);

    @Update("update yz_work set average_score = #{averageScore} where work_id = #{workId}")
    int updateScore(@Param("workId") Long workId,@Param("averageScore") Double averageScore);
}
